/*
 * This file is part of animus, a GUI for the command line app "GHost++"
 *
 * http://code.google.com/p/animus/
 *
 * Copyright (C) 2008-2009 Lucas Romero
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

/*
 * This file is part of animus, a GUI for the command line app "GHost++"
 *
 * Copyright (C) 2008-2009 Lucas Romero
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace animus
{
    public partial class FormCreateGame : Form
    {
        public FormCreateGame()
        {
            InitializeComponent();
            foreach (string s in Properties.Settings.Default.RecentGamenames)
            {
                if (cbGamename.Text.Length == 0)
                {
                    cbGamename.Text = s;
                }
                cbGamename.AutoCompleteCustomSource.Add(s);
                cbGamename.Items.Add(s);
            }
            cbGamename.Select();
            cbGamename.SelectAll();
            //cbGamename.Focus();
        }
        public CreateGameData GameData
        {
            get
            {
                return new CreateGameData(cbGamename.Text, rbPublic.Checked, cbAutoCloseFirstSlot.Checked);
            }
        }

        private void cbGamename_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                bOK.PerformClick();
            }
        }
    }
    public struct CreateGameData
    {
        public CreateGameData(string name, bool pubgame, bool autocloseslot)
        {
            Name = name;
            Public = pubgame;
            AutoCloseSlot = autocloseslot;
        }

        public string Name;
        public bool Public;
        public bool AutoCloseSlot;
    };
}